package com.neuedu.io;

import java.io.*;

/**
 * @author 金山
 * 项目：javase
 * site: https://blog.fulfill.com.cn
 * 描述
 * @data 2024/10/319:39
 */
public class MyFileWriter {

    public static void main(String[] args) {

        File writeCharFile = new File("D:\\upload\\红楼梦.txt");

        //是否追加，  true：追加，  false：覆盖
        boolean append = true;
        try(Writer fileWriter = new FileWriter(writeCharFile,append)){



            //单个字符
            fileWriter.write('a');
            fileWriter.flush();

            fileWriter.write("\t\thello char[]".toCharArray());
            fileWriter.flush();

            fileWriter.write("\t\t我是一堆字符串....");
            fileWriter.flush();


            // fileWriter.append('a').append('x');


        } catch (Exception e) {
           e.printStackTrace();
        }


    }






}
